<?php
$rsDoc = getDocByCatLink($param[1]);
$rsCatInfo=getCatInfoByCatLink($param[1]);
?>

<div class="toplink"><img src="/images/iconhome.gif" /><a href="#"><b>[Trang chủ]</b></a>&raquo;<a href="#" class="pagehere">[Văn bản luật]</a></div>
<div class="help_left">
    <div class="folder" style="padding-top: 0px" >
        <div class="folder-title-new00" >
            <div class="square00"></div>
            <div style="margin-top: 7px;float: left"><a><?php echo htmlentities_utf8($rsCatInfo["cat_title"]);?></a></div>
        </div>
        <div class="folder-body00" >
            <table cellspacing="5" cellpadding="5" border="0" width="100%" class="listdoc" >
                <?php $rsDoc = getDocByCatLink($param[1]);              
                $arrDocs = array();
                while($row=$db->fetch_array($rsDoc)){
                                $arrDocs['id'][] = $row['id'];
                                $arrDocs['title'][] = $row['title'];
                                $arrDocs['filename'][] = $row['filename'];
                            }
                            for($j=0;$j<count($arrDocs['title']);$j=$j+2)
                            {
                                $arrTenFile1 = explode('.',basename($arrDocs['filename'][$j]));
                                $arrTenFile2 = explode('.',basename($arrDocs['filename'][$j+1]));
                            ?>
                        <tr>
                            <td width="40%" >
                                <img src="<?php echo SITE_IMAGES_URL.'/';?><?php
                                     switch(strtolower($arrTenFile1[1]))
                                     {
                                          case 'pdf':{echo 'pdf_icon.gif';break;}
                                         case 'doc':{echo 'doc_icon.gif';break;}
                                         case 'docx':{echo 'doc_icon.gif';break;}
                                         case 'xls':{echo 'excel_icon.gif';break;}
                                         default:{echo 'file_icon.gif';break;}
                                     }
                                     ?>" width="20px" height="20px" style="margin-right: 10px;margin-bottom: -2px"><a href="<?php echo SITE_URL.'/download.php?i='. $arrDocs['id'][$j].'&c='.$arrTenFile1[0];?>"><?php echo $arrDocs["title"][$j];?></a>
                            </td>

                            <td width="40%" >
                                <?php if($arrDocs['id'][$j+1]>0)
                                {
                                ?>
                                <img src="<?php echo SITE_IMAGES_URL.'/';?><?php
                                     switch(strtolower($arrTenFile2[1]))
                                     {
                                         case 'pdf':{echo 'pdf_icon.gif';break;}
                                         case 'doc':{echo 'doc_icon.gif';break;}
                                         case 'docx':{echo 'doc_icon.gif';break;}
                                         case 'xls':{echo 'excel_icon.gif';break;}
                                         default:{echo 'file_icon.gif';break;}
                                     }
                                     ?>" width="20px" height="20px" style="margin-right: 10px;margin-bottom: -2px"><a href="<?php echo SITE_URL.'/download.php?i='. $arrDocs['id'][$j+1].'&c='.$arrTenFile2[0];?>"><?php echo $arrDocs["title"][$j+1];?></a>
                                <? }?>
                            </td>

                        </tr>
    <?php } ?>
            </table>
        </div>
        <div class="folder-bottom00">
            <div class="square-bottom00"></div>
        </div>

    </div>
</div>